<?php
// +----------------------------------------------------------------------
// | snake
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 http://baiyf.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: NickBai <1902822973@qq.com>
// +----------------------------------------------------------------------
namespace app\common\model;


class HtmlToImg
{
    public static function jpg($userId, $applyId)
    {
        $path = ROOT_PATH . 'public' . DS . 'uploads'. DS . 'vote' . DS;
        $fileName = time().rand(10000,99999);
        if(!is_dir($path)) mkdir($path);
        $command = '/home/wkhtmltox/bin/wkhtmltoimage --width 304 --quality 100 v.meiyuer.cn/htmltoimg/index/user_id/'. $userId .'/apply_id/'. $applyId . ' ' . $path . $fileName . '.jpg';
        exec($command);
        return '/uploads/vote/' . $fileName . '.jpg';
    }
}
